package com.special.threademo.requests151demo.enumFactoryBefore;

/**
 * @author LiuYC
 * @version 1.0.0
 * @create 2020-12-31 9:18
 */
public enum CarFactory2 {
    AUDI,BMW;
    public Car create(){
        switch (this){
            case AUDI:
                return new AudiCar();
            case BMW:
                return new BmwCar();

            default:
                throw new AssertionError();
        }
    }
}
